package cn.yrec.rain.analysis.enums;

/**
 * @Description: 计算结果状态枚举类
 * @ClassName: ResultCode
 * @Author: zhupt
 * @CreateTime: 2021/9/3 9:43
 * @Version: 1.0
 */
public enum ResultCode {

    SUCCESS(1, "计算成功"),
    FAIL(2, "计算失败");

    private Integer key;

    private String value;

    private ResultCode(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public static ResultCode getResultCode(int type) {
        ResultCode[] its = ResultCode.values();
        for (ResultCode it : its) {
            if (it.getKey() == type) {
                return it;
            }
        }
        return SUCCESS;
    }

    public Integer getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

}
